﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HA.ModFlow.Domain.DomainLayer;
namespace HA.ModFlow.Controls
{
   public class PCBCFFlow
    {

       public PCBCFFlow(BCFData bcf)
       {
           this._bCFData = bcf;

           this._cloneCopy = this._bCFData.CloneWithoutDataset();

           this._HDRY = this._bCFData.Parent.HDRY;
           this._IHDWET = this._bCFData.Parent.IHDWET;
           this._IWETIT = this._bCFData.Parent.IWETIT;
           this._WETFCT = this._bCFData.Parent.WETFCT;
           this.CanWet = this._bCFData.Parent.CanWet;
       
       }

       BCFData _bCFData;

       public BCFData BCFData
       {
           get { return _bCFData; }
           set { _bCFData = value; }
       }
       BCFData _cloneCopy;

       public BCFData CloneCopy
       {
           get { return _cloneCopy; }
           set { _cloneCopy = value; }
       }



       
        double _HDRY;

        /// <summary>
        /// 干单元的水头值
        /// </summary>
        public double HDRY
        {
            get { return _HDRY; }
            set { _HDRY = value; }
        }



        double _WETFCT;

        /// <summary>
        /// 湿化因子
        /// </summary>
        public double WETFCT
        {
            get { return _WETFCT; }
            set { _WETFCT = value; }
        }

        int _IWETIT;


        /// <summary>
        /// 尝试润湿单元的迭代间隔
        /// </summary>
        public int IWETIT
        {
            get { return _IWETIT; }
            set { _IWETIT = value; }
        }


        int _IHDWET;

        /// <summary>  
        /// 湿化单元的初始水头计算公式
        /// </summary>
        public int IHDWET
        {
            get { return _IHDWET; }
            set { _IHDWET = value; }
        }

        bool _canWet;

        public bool CanWet
        {
            get { return _canWet; }
            set { _canWet = value; }
        }


    
        public void Confirm()
        {

            this._bCFData.Layers = new List<BCFLayer>();
            foreach (BCFLayer item in this.CloneCopy.Layers)
            {
                this._bCFData.Layers.Add((BCFLayer)item.Clone());
            }

       
            this._bCFData.Parent.HDRY = this.HDRY;
            this._bCFData.Parent.IHDWET = this._IHDWET;
            this._bCFData.Parent.IWETIT = this._IWETIT;
            this._bCFData.Parent.WETFCT = this._WETFCT;

            if (this._bCFData.Parent.CanWet != this.CanWet)
            {
                this._bCFData.Parent.CanWet = this.CanWet;
                _bCFData.OnBCFDataChanged();
            }
            else
                this._bCFData.Parent.CanWet = this.CanWet;
           

        }
       

    }
}
